<template>
  <page-main class="page-login-bind">
    <div slot="left">
      <van-icon name="arrow-left" @click="backAccountLogin" />
    </div>
    <div class="bind">
      <van-row type="flex" justify="space-around"  offset="3">
        <van-col span="9">
          <img :src="icon.lgg" width="64px" height="64px" />
          <p>医院</p>
        </van-col>
        <van-col span="6">
          <van-icon name="exchange" />
        </van-col>
        <van-col span="9">
          <img :src="icon.wechat" width="64px" height="64px" />
          <p>微信</p>
        </van-col>
      </van-row>
      <p class="tips">绑定微信账号后，您可以使用微信授权登录进行快速登录</p>
    </div>
    <div class="p-x-15">
      <van-button class="btn-mcolor" round block large @click="wxBinding">前往绑定</van-button>
    </div>
  </page-main>
</template>
<script>
export default {
    data(){
        return{
            icon:{
                lgg: '',
                wechat: '',
            },
            code: null,
            params: {},
        }
    },
    created(){
      this.params = this.$route.query;
    },
    methods:{
      wxBinding(){
        this.$http('put', '/lgg/agency/wxBinding', this.params, (data,msg) => {
          let user_info = JSON.parse(localStorage.getItem('userInfo'));
          if(user_info.completeFlag == '0'){
              this.$util.gotoPage('/');
          }else{
              this.$util.gotoPage('/user/perfect', user_info);
          }
        })
      },
      backAccountLogin(){
        localStorage.removeItem('agencyToken');
        // this.$router.go(-1);
        window.location.href = 'http://www.lggcp.com/agency/index.html';
      }
    }
}
</script>
